﻿using System;
using System.Collections;
using System.Text;
using System.Xml.Linq;
using Microsoft.Build.Framework;

namespace Adjunct.Build.Tasks
{
	public class MockBuildEngine : IBuildEngine
	{
		private readonly XElement _log = new XElement("Log");

		public void LogErrorEvent(BuildErrorEventArgs e) {
			_log.Add(new XElement("Error", e.Message));
		}

		public void LogWarningEvent(BuildWarningEventArgs e) {
			_log.Add(new XElement("Warn", e.Message));
		}

		public void LogMessageEvent(BuildMessageEventArgs e) {
			_log.Add(new XElement("Info", e.Message));
		}

		public void LogCustomEvent(CustomBuildEventArgs e) {
			_log.Add(new XElement("Custom", e.Message));
		}

		public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs) {
			throw new System.NotImplementedException();
		}

		public XElement Log {
			get { return _log; }
		}

		public bool ContinueOnError {
			get { throw new System.NotImplementedException(); }
		}

		public int LineNumberOfTaskNode {
			get { return 31415927; }
		}

		public int ColumnNumberOfTaskNode {
			get { return 42; }
		}

		public string ProjectFileOfTaskNode { get; set; }
	}
}